#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=100009;
ll m,cnt[N],mx;
void input(){
    cin>>m;
}
void solveBF(){
    for(ll i=1;i<=m;i++){
        ll op,val;
        scanf("%lld %lld",&op,&val);
        mx=max(mx,val);
        if(op==1) cnt[val]++;
        else if(cnt[val]) cnt[val]--;
        printf("%lld\n",max_element(cnt+1,cnt+mx+1)-cnt);
    }
}
int main(){
    freopen("mode.in","r",stdin);
    freopen("modeBF.out","w",stdout);
    input();
    solveBF();
    return 0;
}
